using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableEquipForgeOddsDao:DaoBase<TableEquipForgeOdds>
    {
        public override void AddPrimaryIndex(TableEquipForgeOdds model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableEquipForgeOdds.txt";
        }

        protected override TableEquipForgeOdds ParseRowData(string[] rowData)
        {
            TableEquipForgeOdds data = new TableEquipForgeOdds();
			data.id = rowData [0];
			data.quality = rowData [1];

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.forgeLevel = 0;
            }
            else
            {
                data.forgeLevel = int.Parse(rowData[2]);
            }
			data.odds = rowData [3];
			data.cost = rowData [4];

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.fragNum = 0;
            }
            else
            {
                data.fragNum = int.Parse(rowData[5]);
            }

            return data;
        }


        public override void AddOneIndex(TableEquipForgeOdds model)
        {
            if (!cacheOneIndex.ContainsKey(model.quality.ToString()))
            {
                cacheOneIndex[model.quality.ToString()] = new List<TableEquipForgeOdds>();
            }
            cacheOneIndex[model.quality.ToString()].Add(model);
        }
    

    }

}
